#define _CRT_SECURE_NO_WARNINGS 1
#include <stdlib.h>
#include <stdio.h>
#include <string.h>




void hasCycle(struct ListNode* head) {
    struct ListNode* s = head;
    struct ListNode* f = head;
    while ((f->next != NULL) || (f != NULL))
    {
        s = s->next;
        f = f->next->next;
        if ((s->val) == (f->val))
        {
            return true;
        }

    }
    return false;
}